-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[libcxx] [test] Fix the gets-removed.verify.cpp test with Clang 21 #169235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes test errors like this, at least for a mingw target,
if building with Clang 21 instead of Clang 20, as in the CI
environment:
# .---command stderr------------
# | error: 'expected-error' diagnostics seen but not expected:
# | File C:\a\llvm-mingw\llvm-mingw\llvm-project\libcxx\test\std\input.output\file.streams\c.files\gets-removed.verify.cpp Line 16: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1
This extra, unexpected diagnostic appears in Clang 21, since
commit 9eef4d1 ("Remove delayed
typo expressions"). Before this, we got the expected diagnostic
`error: no member named 'gets' in namespace 'std'`, with the
typo correction hint `did you mean 'puts'?`. After this change,
we get the typo correction hint `did you mean simply 'gets'?`
instead. And with the typo correction finding `::gets`, it goes on
to produce a second diagnostic about mismatched parameter for
that function.
Avoid these unexpected diagnostics by passing the right type of
parameter to the gets function.
|
@llvm/pr-subscribers-libcxx Author: Martin Storsjö (mstorsjo) ChangesThis fixes test errors like this, at least for a mingw target, if building with Clang 21 instead of Clang 20, as in the CI environment: This extra, unexpected diagnostic appears in Clang 21, since commit 9eef4d1 ("Remove delayed typo expressions"). Before this, we got the expected diagnostic Avoid these unexpected diagnostics by passing the right type of parameter to the gets function. Full diff: https://github.com/llvm/llvm-project/pull/169235.diff 1 Files Affected:
diff --git a/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp b/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
index 281ef37e92d27..fb49375a21baa 100644
--- a/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
+++ b/libcxx/test/std/input.output/file.streams/c.files/gets-removed.verify.cpp
@@ -12,6 +12,6 @@
#include <cstdio>
-void f(char const* str) {
+void f(char* str) {
(void)std::gets(str); // expected-error {{no member named 'gets' in namespace 'std'}}
}
|
|
This fixes a new issue caught in my weekly testing of libcxx tests with a fresh nightly Clang for llvm-mingw, at https://github.com/mstorsjo/llvm-mingw/actions/runs/19612006242/job/56159201525. |
…lvm#169235) This fixes test errors like this, at least for a mingw target, if building with Clang 21 instead of Clang 20, as in the CI environment: # .---command stderr------------ # | error: 'expected-error' diagnostics seen but not expected: # | File C:\a\llvm-mingw\llvm-mingw\llvm-project\libcxx\test\std\input.output\file.streams\c.files\gets-removed.verify.cpp Line 16: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *' # | 1 error generated. # `----------------------------- # error: command failed with exit status: 1 This extra, unexpected diagnostic appears in Clang 21, since commit 9eef4d1 ("Remove delayed typo expressions"). Before this, we got the expected diagnostic `error: no member named 'gets' in namespace 'std'`, with the typo correction hint `did you mean 'puts'?`. After this change, we get the typo correction hint `did you mean simply 'gets'?` instead. And with the typo correction finding `::gets`, it goes on to produce a second diagnostic about mismatched parameter for that function. Avoid these unexpected diagnostics by passing the right type of parameter to the gets function.
…lvm#169235) This fixes test errors like this, at least for a mingw target, if building with Clang 21 instead of Clang 20, as in the CI environment: # .---command stderr------------ # | error: 'expected-error' diagnostics seen but not expected: # | File C:\a\llvm-mingw\llvm-mingw\llvm-project\libcxx\test\std\input.output\file.streams\c.files\gets-removed.verify.cpp Line 16: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *' # | 1 error generated. # `----------------------------- # error: command failed with exit status: 1 This extra, unexpected diagnostic appears in Clang 21, since commit 9eef4d1 ("Remove delayed typo expressions"). Before this, we got the expected diagnostic `error: no member named 'gets' in namespace 'std'`, with the typo correction hint `did you mean 'puts'?`. After this change, we get the typo correction hint `did you mean simply 'gets'?` instead. And with the typo correction finding `::gets`, it goes on to produce a second diagnostic about mismatched parameter for that function. Avoid these unexpected diagnostics by passing the right type of parameter to the gets function.
This fixes test errors like this, at least for a mingw target, if building with Clang 21 instead of Clang 20, as in the CI environment:
This extra, unexpected diagnostic appears in Clang 21, since commit 9eef4d1 ("Remove delayed typo expressions"). Before this, we got the expected diagnostic
error: no member named 'gets' in namespace 'std', with the typo correction hintdid you mean 'puts'?. After this change, we get the typo correction hintdid you mean simply 'gets'?instead. And with the typo correction finding::gets, it goes on to produce a second diagnostic about mismatched parameter for that function.Avoid these unexpected diagnostics by passing the right type of parameter to the gets function.